//
//  FenXiangTableViewCell.m
//  XiangMu
//
//  Created by 康世标 on 15/7/17.
//  Copyright (c) 2015年 康世标. All rights reserved.
//
#define kDistance 20
#define TableHeader 50
#define ShowImage_H 80
#define screenWidth  [UIScreen mainScreen].bounds.size.width

#import "FenXiangTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation FenXiangTableViewCell

- (void)awakeFromNib {
    // Initialization code]
    [_touXiang.layer setMasksToBounds:YES];
    [_touXiang.layer setCornerRadius:_touXiang.frame.size.height/2];
    
      _imageArray = [[NSMutableArray alloc] initWithCapacity:0];
   
}

- (void)Commmend:(NSArray *)arr{

    
        for (int i = 0; i < [_imageArray count]; i++)
        {
    
            UIImageView * imageV = (UIImageView *)[_imageArray objectAtIndex:i];
            if (imageV.superview)
            {
                [imageV removeFromSuperview];
    
            }
    
        }
    
        [_imageArray removeAllObjects];
    
    for (int  i = 0; i < arr.count; i++) {
             NSString * newUrl = [[arr objectAtIndex:i] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  
        
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(((screenWidth - 240)/4)*(i%3 + 1) + 80*(i%3), self.label3.frame.size.height+self.label3.frame.origin.y + 10 * ((i/3) + 1) + (i/3) *  ShowImage_H-10  , 80, ShowImage_H)];
        image.userInteractionEnabled = YES;
        
        [image sd_setImageWithURL:[NSURL URLWithString:newUrl] placeholderImage:[UIImage imageNamed:@"like"]];
        
        //        YMTapGestureRecongnizer *tap = [[YMTapGestureRecongnizer alloc] initWithTarget:self action:@selector(tapImageView:)];
        //        [image addGestureRecognizer:tap];
        //        tap.appendArray = ymData.showImageArray;

        //        image.tag = kImageTag + i;
        //        image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",[ymData.showImageArray objectAtIndex:i]]];
          [self.contentView addSubview:image];
            [_imageArray addObject:image];
        
    }

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
